﻿#region Copyright
/* © 2008 George Tsiokos, licensed under the Microsoft Reciprocal License (Ms-RL) */
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using Comet.Diagnostics.PerformanceCounters;

namespace Comet.Diagnostics {
    internal sealed class InstrumentPerformanceCounter<T> : Instrument {

        #region Fields (1)

        PerformanceCounter _performanceCounter;

        #endregion Fields

        #region Constructors (1)

        public InstrumentPerformanceCounter (string instance) {
            _performanceCounter = PerformanceCounterUtility.GetInstance<T> (instance);
        }

        #endregion Constructors

        #region Methods (2)


        // Public Methods (2) 

        public override void Stop () {
            _performanceCounter.NextValue ();
        }

        public override void Start () {
            _performanceCounter.RawValue = Stopwatch.GetTimestamp ();
        }


        #endregion Methods

    }
}